// 全局变量封装，所有注入脚本都可访问和监听
(function(){
    if (!window.__MY_GLOBAL_VAR__) {
        window.__MY_GLOBAL_VAR__ = {};
    }
    window.setMyGlobalVar = function (key, value) {
        window.__MY_GLOBAL_VAR__[key] = value;
        window.dispatchEvent(new CustomEvent('MY_GLOBAL_VAR_CHANGE', { detail: { key, value } }));
    };
    window.getMyGlobalVar = function (key) {
        return window.__MY_GLOBAL_VAR__[key];
    };
})();
